package leetcode.simple.q448;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        int[] arr = {4,3,2,7,8,2,3,1};
        int[] arr2 = {5,4,6,7,9,3,10,9,5,6};

        List<Integer> disappearedNumbers = findDisappearedNumbers(arr2);
        System.out.println(disappearedNumbers);

    }

    /**
     * 我的题解1
     * @param nums
     * @return
     */
    public static List<Integer> findDisappearedNumbers(int[] nums) {
        List<Integer> list = new ArrayList<>();
        int n = nums.length;

        Set set = new HashSet();

        for (int i = 0; i < n; i++) {
            set.add(nums[i]);
        }

        for (int i = 1; i <= n; i++) {
            if (!set.contains(i)){
                list.add(i);
            }
        }

        return list;
    }
}
